From c362ef8a028e970eb4c42a6bc82bbdfb69135b63 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Sun, 15 Jul 2007 13:40:47 -0600 Subject: [PATCH] [IA64] Speedup ptc.e emulation This patch makes ptc.e emulation faster. It defers the initialization of collision chain area of VHPT. Also removes an unused field from struct thash_cb. Signed-off-by: Kouya Shimura --- xen/arch/ia64/vmx/vtlb.c | 41 ++++++++++++++----------------------- xen/include/asm-ia64/vmmu.h | 2 +- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/xen/arch/ia64/vmx/vtlb.c b/xen/arch/ia64/vmx/vtlb.c index 8fa6b4c598..0348bc3416 100644 --- a/xen/arch/ia64/vmx/vtlb.c +++ b/xen/arch/ia64/vmx/vtlb.c @@ -36,19 +36,10 @@ thash_data_t *__alloc_chain(thash_cb_t *); -static void cch_mem_init(thash_cb_t *hcb) +static inline void cch_mem_init(thash_cb_t *hcb) { - int num; - thash_data_t *p; - - hcb->cch_freelist = p = hcb->cch_buf; - num = (hcb->cch_sz/sizeof(thash_data_t))-1; - do{ - p->next =p+1; - p++; - num--; - }while(num); - p->next = NULL; + hcb->cch_free_idx = 0; + hcb->cch_freelist = NULL; } static thash_data_t *cch_alloc(thash_cb_t *hcb) @@ -56,8 +47,16 @@ static thash_data_t *cch_alloc(thash_cb_t *hcb) thash_data_t *p; if ( (p = hcb->cch_freelist) != NULL ) { hcb->cch_freelist = p->next; + return p; + } + if (hcb->cch_free_idx < hcb->cch_sz/sizeof(thash_data_t)) { + p = &((thash_data_t *)hcb->cch_buf)[hcb->cch_free_idx++]; + p->page_flags = 0; + p->itir = 0; + p->next = NULL; + return p; } - return p; + return NULL; } /* @@ -668,13 +667,12 @@ thash_data_t *vtlb_lookup(VCPU *v, u64 va,int is_data) void thash_init(thash_cb_t *hcb, u64 sz) { int num; - thash_data_t *head, *p; + thash_data_t *head; hcb->pta.val = (unsigned long)hcb->hash; hcb->pta.vf = 1; hcb->pta.ve = 1; hcb->pta.size = sz; - hcb->cch_rec_head = hcb->hash; head=hcb->hash; num = (hcb->hash_sz/sizeof(thash_data_t)); @@ -686,16 +684,7 @@ void thash_init(thash_cb_t *hcb, u64 sz) head++; num--; }while(num); - - hcb->cch_freelist = p = hcb->cch_buf; - num = hcb->cch_sz / sizeof(thash_data_t); - do{ - p->page_flags = 0; - p->itir = 0; - p->next =p+1; - p++; - num--; - }while(num); - (p - 1)->next = NULL; + hcb->cch_free_idx = 0; + hcb->cch_freelist = NULL; } diff --git a/xen/include/asm-ia64/vmmu.h b/xen/include/asm-ia64/vmmu.h index 668a0ceb96..90f160605d 100644 --- a/xen/include/asm-ia64/vmmu.h +++ b/xen/include/asm-ia64/vmmu.h @@ -196,8 +196,8 @@ typedef struct thash_cb { u64 hash_sz; // size of above data. void *cch_buf; // base address of collision chain. u64 cch_sz; // size of above data. + u64 cch_free_idx; // index of free entry. thash_data_t *cch_freelist; - thash_data_t *cch_rec_head; // cch recycle header PTA pta; } thash_cb_t; -- 2.30.2